package net.zigin.nhi.could.waste.service.impl;

import net.zigin.commons.util.ReflectUtil;
import net.zigin.nhi.could.waste.dao.*;
import net.zigin.nhi.could.waste.model.AreaCity;
import net.zigin.nhi.could.waste.model.AreaRegion;
import net.zigin.nhi.could.waste.model.AreaTown;
import net.zigin.nhi.could.waste.vo.AreaTownVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.zigin.nhi.could.waste.model.AreaProvince;
import net.zigin.nhi.could.waste.service.AreaProvinceService;

import java.util.List;

/*#################################################################*
# 说明:以下代码通过哲勤代码生成工具自动生成    
# 工具:GeneratorCode
# 作者:mgw1986                                                  
# 生成时间:2021-9-9 21:00:31                                               
##################################################################*/


/**
 *  AreaProvince服务实现类
 * @ClassName: AreaProvinceServiceImpl
 * @author mgw1986
 * @date 2021-9-9 21:00:31
 * @version V1.0
 */
@Service
public class AreaProvinceServiceImpl extends AbstractServiceImpl<AreaProvince, String> implements AreaProvinceService{
	@Autowired
	private AreaProvinceMapper areaProvinceMapper;
	@Autowired
	private AreaCityMapper areaCityMapper;
	@Autowired
	private AreaRegionMapper areaRegionMapper;
	@Autowired
	private AreaTownMapper areaTownMapper;

	@Override
	public BaseMapper<AreaProvince, String> getMapper() {
		return areaProvinceMapper;
	}

	@Override
	public List<AreaTownVo> getAll() {
		List<AreaTown> areaTowns = areaTownMapper.selectAllList();
		List<AreaTownVo> areaTownVos = ReflectUtil.copyProperties(areaTowns, AreaTownVo.class);
		List<AreaRegion> areaRegions = areaRegionMapper.selectAllList();
		List<AreaTownVo> areaTownVos1 = ReflectUtil.copyProperties(areaRegions, AreaTownVo.class);
		List<AreaCity> areaCities = areaCityMapper.selectAllList();
		List<AreaTownVo> areaTownVos2 = ReflectUtil.copyProperties(areaCities, AreaTownVo.class);
		List<AreaProvince> areaProvinces = areaProvinceMapper.selectAllList();
		List<AreaTownVo> areaTownVos3 = ReflectUtil.copyProperties(areaProvinces, AreaTownVo.class);
		areaTownVos.addAll(areaTownVos1);
		areaTownVos.addAll(areaTownVos2);
		areaTownVos.addAll(areaTownVos3);
		return areaTownVos;
	}
}